'use client';

import React from 'react';
import { useRouter } from 'next/navigation';
import { PageContainer } from '@ant-design/pro-components';
import { DemandOrder } from '@/types/order';
import DemandOrderForm from '../components/DemandOrderForm';

const CreateDemandOrderPage: React.FC = () => {
  const router = useRouter();

  // 创建成功回调
  const handleCreateSuccess = (newOrder: DemandOrder) => {
    // 跳转到详情页
    router.push(`/orders/demand/${newOrder.id}`);
  };

  // 取消创建
  const handleCancel = () => {
    router.push('/orders');
  };

  return (
    <PageContainer title="创建需求订单">
      <DemandOrderForm
        mode="create"
        onSave={handleCreateSuccess}
        onCancel={handleCancel}
      />
    </PageContainer>
  );
};

export default CreateDemandOrderPage; 